#! /bin/bash
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
create database if not exists zxoe_dws;

drop table if exists zxoe_dws.dws_attend_later;
create table zxoe_dws.dws_attend_later(
    class_id string comment '班级id',
    date_time string comment '出勤迟到的当天日期',
    morning_begin_time string comment '上午开始时间',
    morning_end_time string comment '上午结束时间',
    afternoon_begin_time string comment '下午开始时间',
    afternoon_end_time string comment '下午结束时间',
	evening_begin_time string comment '晚上开始时间',
    evening_end_time string comment '晚上结束时间',
    statues int comment '状态码0-->上午,状态码1-->下午,状态码2-->晚上',
    attend_counts bigint comment '出勤人数',
    later_counts bigint comment '迟到人数'
) comment '出勤迟到主题表'
partitioned by (dt string)
row format delimited
fields terminated by '\t'
stored as orc
tblproperties('orc.compress'='snappy');

drop table if exists zxoe_dws.dws_leave;
create table zxoe_dws.dws_leave(
    class_id string comment '班级id',
    date_time string comment '请假的当天日期',
    morning_begin_time string comment '上午开始时间',
    morning_end_time string comment '上午结束时间',
    afternoon_begin_time string comment '下午开始时间',
    afternoon_end_time string comment '下午结束时间',
    evening_begin_time string comment '晚上开始时间',
    evening_end_time string comment '晚上结束时间',
    statues int comment '状态码0-->上午,状态码1-->下午,状态码2-->晚上',
    leave_counts bigint comment '请假人数'
) comment '请假主题宽表'
partitioned by (dt string)
row format delimited
fields terminated by '\t'
stored as orc
tblproperties('orc.compress'='snappy');

drop table if exists zxoe_dws.dws_truancy;
create table zxoe_dws.dws_truancy(
    class_id string comment '班级id',
    date_time string comment '请假的当天日期',
    morning_begin_time string comment '上午开始时间',
    morning_end_time string comment '上午结束时间',
    afternoon_begin_time string comment '下午开始时间',
    afternoon_end_time string comment '下午结束时间',
    evening_begin_time string comment '晚上开始时间',
    evening_end_time string comment '晚上结束时间',
    statues int comment '状态码0-->上午,状态码1-->下午,状态码2-->晚上',
    truancy_counts bigint comment '旷课人数'
) comment '旷课人数主题'
partitioned by (dt string)
row format delimited
fields terminated by '\t'
stored as orc
tblproperties('orc.compress'='snappy');
"